﻿using System;
using System.Text;
using System.Web.UI;
using System.ComponentModel;

namespace Lswweb.Controls
{
    public class Marquee: SkinnedWebControl
    {
   
        private ITemplate contentTemplate=null;
        private Control contentPanel;

        protected override void InitializeSkin(Control skin)
        {
            contentPanel = skin.FindControl("contentPanel");

            if (ContentTemplate != null && contentPanel != null)
                ContentTemplate.InstantiateIn(contentPanel);
        }

        #region 公共属性


        [Browsable(false)]
        [TemplateContainer(typeof(Lswweb.Controls.Panel))]
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public ITemplate ContentTemplate
        {
            get { return contentTemplate; }
            set { contentTemplate = value; }
        }

        #endregion

        public override Control FindControl(string id)
        {
            EnsureChildControls();
            Control control=base.FindControl(id);

            if (control == null && contentPanel != null)
                control = contentPanel.FindControl(id);

            return control;
        }

        protected override string DefaultSkinFilename
        {
            get { return "Marquee.ascx"; }
        }
    }
}
